home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / 4dostool / 4dtip2.zip / DO.BTM next >
Text File  |  1992-07-06  |  11KB  |  401 lines

  1. @ECHO off
  2. if "%1" == "" goto help
  3. goto %1
  4. quit
  5.  
  6. REM ───────────────────────────────────────────────── Help
  7. :help
  8. echo.
  9. echo Usage: DO function [options]
  10. echo.
  11. echo where function stands for
  12. echo.
  13. echo fullback - Full Backup
  14. echo incrback - Incremental Backup
  15. echo rest     - Restore
  16. echo.
  17. echo chkdsk   - Check disk
  18. echo vircheck - run virus checker (f-prot)
  19. echo.
  20. echo normal   - Reset to 4DOS environment
  21. echo.
  22. echo ho       - Set home directory / change to home directory
  23. echo.
  24. echo hack     - NetHack
  25. echo info     - shows some system information
  26. echo.
  27. quit
  28.  
  29. REM ───────────────────────────────────────────────── Disk oriented routines
  30.  
  31. REM ------------------------------------------------- Full Backup
  32. :fullback
  33.  
  34. setlocal
  35. unalias *
  36. set fg=%_fg
  37. set bg=%_bg
  38.  
  39. gosub GetDrive
  40. color bright white on black
  41. echo Full Backup of Drive %DRIVE% named %@LABEL[%DRIVE%].
  42. color %fg on %bg
  43.  
  44. cd \
  45. gosub CleanUp
  46. gosub DoVirCheck /quick
  47.  
  48. :retry
  49. del /q \backup.log
  50. C:\DOS\backup %DRIVE% A: /s /l
  51. set job=Backup
  52. gosub ReportSuccess
  53. if %YesNo% == Y GOTO retry
  54. endlocal
  55. quit
  56.  
  57. REM ------------------------------------------------- Incremental Backup
  58. :incrback
  59.  
  60. setlocal
  61. unalias *
  62. set fg=%_fg
  63. set bg=%_bg
  64.  
  65. gosub GetDrive
  66.  
  67. color bright white on black
  68. echo Incremental Backup of Drive %DRIVE% named %@LABEL[%DRIVE%].
  69. color %fg on %bg
  70. gosub CleanUp
  71. gosub DoVirCheck /quick
  72. C:\TOOLS\newfiles /tot %DRIVE%
  73.  
  74. :retry
  75. C:\DOS\backup %DRIVE% A: /m /s /a /l
  76. set job=Backup
  77. gosub ReportSuccess
  78. if %YesNo% == Y GOTO retry
  79. endlocal
  80. quit
  81.  
  82. REM ------------------------------------------------- Restore
  83. :rest
  84.  
  85. setlocal
  86. unalias *
  87. set fg=%_fg
  88. set bg=%_bg
  89.  
  90. gosub GetDrive
  91. set DIRNAME=%@SUBSTR[%@FULL[%2],2,255]
  92. set DIR=%@UPPER[%@PATH[%DIRNAME%]]
  93. iff %@INDEX[%2,*] GE 0 .OR. %@INDEX[%2,?] GE 0 THEN
  94.  set ISAMBIG=Y
  95. else
  96.  set ISAMBIG=N
  97. endiff
  98. color bright white on black
  99. echo Restoring %DRIVE%%DIRNAME%...
  100. color %fg on %bg
  101. iff %ISAMBIG%==Y then find /I "%DIR%" %DRIVE%\backup.log|more.com
  102.                  else find /I "%DIRNAME%" %DRIVE%\backup.log|more.com
  103. endiff
  104. color bright white on black
  105. echo Please insert appropriate disk.
  106. color %fg on %bg
  107. iff %ISAMBIG%=Y then C:\DOS\restore A: %DRIVE%%DIRNAME% /s /p
  108.                 else C:\DOS\restore A: %DRIVE%%DIRNAME% /p
  109. endiff
  110. set job=Restore
  111. gosub ReportSuccess
  112. endlocal
  113. quit
  114.  
  115. REM ------------------------------------------------- CHKDSK
  116. :chkdsk
  117.  
  118. gosub DoChkDsk
  119. quit
  120.  
  121. REM ------------------------------------------------- Virus Check
  122. :vircheck
  123. setlocal
  124. unalias *
  125. set fg=%_fg
  126. set bg=%_bg
  127.  
  128. gosub GetDrive
  129. gosub DoVirCheck
  130. endlocal
  131. quit
  132.  
  133. REM ─────────────────────────────────────────── Environment oriented routines
  134. REM ------------------------------------------------- Normal Environment
  135. :normal
  136. unset *
  137. set /r C:\4DOS\environ
  138. alias /r C:\4DOS\aliases
  139. echo 4DOS-Configuration read.
  140. quit
  141.  
  142. REM ------------------------------------------------- Home
  143. :ho
  144. iff "%2" == "" then
  145.  echos Changing to %@upper[%home%]...
  146.  cdd %home%
  147. else
  148.  setlocal
  149.  *set home=%@upper[%@full[%2]]
  150.  *unset /q tmp temp cmdline comspec
  151.  iff %@index[%@upper[%path],G:\] GE 0 then
  152.   *set path=%@substr[%path,4,255]
  153.  endiff
  154.  echo New Home directory will be: %home%.
  155.  *set > c:\4DOS\environ.
  156.  endlocal
  157.  *set /r C:\4DOS\environ.
  158. endiff
  159. quit
  160.  
  161. REM ─────────────────────────────────────────────────────────── Applications
  162. REM ------------------------------------------------- NetHack
  163. :hack
  164. setlocal
  165. unalias *
  166.  
  167. iff "%2"=="" then C:\NETHACK\nhack
  168. else
  169.  iff "%4" == "c" then set term=ibmpc
  170.  elseiff "%4" == "m" then set term=ibmpc-mono
  171.  else
  172.   inkey /K"CM" /W5 [C]olor or [M]ono ? %%ask
  173.   set ask=%@UPPER[%ask]
  174.   iff "%ask" == "C" then set term=ibmpc
  175.                     else set term=ibmpc-mono
  176.   endiff
  177.  endiff
  178.  
  179.  IFF %@READY[G:] == 1 THEN
  180.   ECHO Installing NetHack on RamDisk G:
  181.   cdd g:\
  182.   except (4*.* acd.*) del /sxy G:\*.* >& NUL:
  183.   *md SAVE
  184.   cdd c:\NETHACK
  185.   set size=%@FILESIZE[C:\NETHACK\SAVE\SAVE2\%2.SAV,K]
  186.   iff "%size" GT "300" then
  187.    copy /q normhack.cnf nethack.cnf
  188.    set hackmode=0
  189.   elseiff "%size" GT "200" then
  190.    copy /q halfhack.cnf nethack.cnf
  191.    set hackmode=50
  192.   else
  193.    copy /q fullhack.cnf nethack.cnf
  194.    set hackmode=100
  195.   endiff
  196.  ELSE
  197.   copy /q normhack.cnf nethack.cnf
  198.   set hackmode=0
  199.  ENDIFF
  200.  
  201.  :restore
  202.  iff %hackmode=0 then
  203.   copy /q C:\NETHACK\SAVE\SAVE2\%2.SAV C:\NETHACK\SAVE
  204.  elseiff %hackmode=50  then
  205.   copy /q halfhack.cnf nethack.cnf
  206.   copy /q C:\NETHACK\SAVE\SAVE2\%2.SAV C:\NETHACK\SAVE
  207.  else
  208.   copy /q fullhack.cnf nethack.cnf
  209.   copy /q C:\NETHACK\SAVE\SAVE2\%2.sav G:\SAVE
  210.  endiff
  211.  :goon
  212.  C:\NETHACK\nhack %2-%3
  213.  
  214.  iff %hackmode% GT 50  then move /q G:\SAVE\%2.sav C:\NETHACK\SAVE\SAVE2
  215.                        else move /q C:\NETHACK\SAVE\%2.sav C:\NETHACK\SAVE\SAVE2
  216.  endiff
  217.  inkey /K"YN " /W5 Try again (Y/N) ? %%ask
  218.  set ask=%@UPPER[%ask]
  219.  iff "%ask" == "Y" .OR. "%ask" == " " then goto /I restore endiff
  220.  echo.
  221. endiff
  222. endlocal
  223. quit
  224.  
  225. REM ─────────────────────────────────────────────────────────── Jokes
  226. :info
  227. setlocal
  228. set alias=%_alias
  229. unalias *
  230. set fg=%_fg
  231. set bg=%_bg
  232.  
  233. cls
  234. drawbox 0 0 %@eval[%_ROWS-1] %@eval[%_COLUMNS-1] 0 white on Cyan fill Cyan
  235. vscrput 10 0 black on white 4DOS INFO
  236. vscrput 10 %@eval[%_COLUMNS-1] black on white 4DOS INFO
  237.  
  238. drawbox 2 2 8 46 1 black on white fill white shadow
  239. color black on white
  240. screen 2 15 [Environment]
  241. screen 3  3 You are running
  242. scrput 3 19 red   on white 4DOS %_4VER
  243. screen 3 28 under
  244. scrput 3 34 red   on white %_DOS %_DOSVER
  245. screen 3 42 .
  246. screen 5 3  Free Environment Space : %_ENV Bytes
  247. screen 6 3  Free Alias       Space : %ALIAS Bytes
  248. iff %_ANSI == 0 then screen 7 3  ANSI.SYS not installed.
  249. elseiff %_ANSI == 1 then screen 7 3  ANSI.SYS will be supported.
  250. endiff
  251.  
  252. drawbox 2 49 8 75 1 bright yellow on green fill green shadow
  253. color bright yellow on green
  254. screen  2 59 [Hardware]
  255. screen  3 50 CPU        :
  256. scrput  3 63 bright white on green %_CPU
  257. screen  4 50 Coprocessor:
  258. scrput  4 63 bright white on green %_NDP
  259. screen  5 50 Video card :
  260. scrput  5 63 bright white on green %@UPPER[%_VIDEO] (%_COLUMNS%x%_ROWS%)
  261. screen  7 50 Actual Codepage is %_CODEPAGE%.
  262.  
  263. drawbox 10 2 15 75 1 bright white on blue fill blue shadow
  264. color bright white on blue
  265. screen  10 20 [Memory]
  266. screen  11 3  Available Conventional memory:
  267. scrput  11 34 bright yellow on blue  %@DOSMEM[b] Bytes.
  268. screen  12 3  Available XMS          memory:
  269. scrput  12 34 bright yellow on blue  %@XMS[b] Bytes.
  270. screen  12 50 Extended:
  271. scrput  12 61 bright yellow on blue  %@EXTENDED[b] Bytes.
  272. screen  13 3  Available Expanded     memory:
  273. scrput  13 34 bright yellow on blue  %@EMS[b] Bytes.
  274.  
  275. iff     %_win == 0 then scrput 14 3 white on blue Windows is not running.
  276. elseiff %_win == 1 then scrput 14 3 white on blue Windows is running. (in real!! mode)
  277. elseiff %_win == 2 then scrput 14 3 white on blue Windows is running. (in standard mode)
  278. elseiff %_win == 3 then scrput 14 3 white on blue Windows is running. (in enhanced mode)
  279. endiff
  280.  
  281. drawbox 17 2 23 37 1 bright white on Magenta fill Magenta shadow
  282. color bright white on Magenta
  283. screen  17 15 [Harddisks]
  284.  
  285. iff %@ready[C:] == 1 then ^ screen 18 4 Free Space on Drive C: %@DISKFREE[C:,m] MB. ^ endiff
  286. iff %@ready[D:] == 1 then ^ screen 19 4 Free Space on Drive D: %@DISKFREE[D:,m] MB. ^ endiff
  287. iff %@ready[E:] == 1 then ^ screen 20 4 Free Space on Drive E: %@DISKFREE[E:,m] MB. ^ endiff
  288. iff %@ready[F:] == 1 then ^ screen 21 4 Free Space on Drive F: %@DISKFREE[F:,m] MB. ^ endiff
  289. iff %_LASTDISK GE G .and. %@ready[G:] == 1 then ^ screen 22 4 Free Space on Drive G: %@DISKFREE[G:,m] MB. ^ endiff
  290.  
  291. drawbox 17 40 20 75 1 white on black fill black shadow
  292. color white on black
  293. screen 17 50 [Date & Time]
  294. screen 18 41 %_DOW, the %_DATE at %_TIME.
  295.  
  296. color black on white
  297. screen %@eval[%_ROWS-1] 2 Press a key to abort...
  298. inkey %%dummy
  299. cls
  300. endlocal
  301. quit
  302.  
  303. REM ══════════════════════════════════════════════════════ common subroutines
  304.  
  305. REM ------------------------------------------------------ GetDrive
  306. :GetDrive
  307. iff "%2" == ""